package com.bd08.flink.demo.zhang

import org.apache.flink.api.java.aggregation.Aggregations
import org.apache.flink.api.scala.{ExecutionEnvironment, createTypeInformation}

object Aggregate extends App {
  val env = ExecutionEnvironment.getExecutionEnvironment
  val ds  = env.fromCollection(List("a","b","c","d","a","c"))
  ds.map((_,1)).aggregate(Aggregations.SUM,1).print()
  ds.map((_,1)).groupBy(0).aggregate(Aggregations.SUM,1).print()

  ds.map((_,1)).groupBy(0).sum(1).max(1).print()

}
